%solving an integer program using yalmip
clear all;
clc;

x = [1 2 3 4 5 6]';
t = [0:0.02:2*pi]';
a = [sin(t) sin(2*t) sin(3*t) sin(4*t) sin(5*t) sin(6*t)];

y = a*x + (-4+8*rand(length(a),1));

%x_hat = intvar(6,1);
x_hat = sdpvar(6,1);

residuals = y - a*x_hat;

bound = sdpvar(length(residuals),1);
F = [-bound <= residuals <= bound];
solvesdp(F,sum(bound),sdpsettings('solver','sdpt3'));
%solvesdp([],residuals'*residuals,sdpsettings('solver','bnb'));
x_L1 = double(x_hat)

